﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;

namespace CPPEI.EventBus
{
    class Util
    {
        public static T GetAttribute<T>(MethodInfo methodInfo)
        {
            object[] attrArr = methodInfo.GetCustomAttributes(typeof(T), true);
            for (int index = 0; index < attrArr.Length; index++)
            {
                if (attrArr[index] is T)
                {
                    return (T)attrArr[index];
                }
            }
            return default(T);
        }
    }
}
